package com.leinao.media.factory;

import com.leinao.media.client.MediaClient;

import java.lang.reflect.Proxy;

/**
 * 服务工厂类
 *
 * @author zhangyu
 */
public class ServiceFactory {

    public static <T> T register(Class<T> clazz, MediaClient mediaClient) {
        ServiceHandler<T> traceHandler = new ServiceHandler(clazz, mediaClient);
        return (T) Proxy.newProxyInstance(ServiceFactory.class.getClassLoader(), new Class[]{clazz}, traceHandler);
    }
}
